#ifndef LOADINGTHREAD_H
#define LOADINGTHREAD_H

#include <QThread>
#include "libvcard/vcard.h"
#include "qmobex/qmobex.h"

typedef QHash<int, vCard> vCardHash;

class LoadingThread : public QThread
{
    Q_OBJECT
public:
    LoadingThread( QMobex *phoneDevice = 0);
    ~LoadingThread();
    //LoadingThread();

signals:
    void parsed(int counter);
    void total(int);

public slots:
    void load(vCardHash *table, QByteArray from );
    void stop();
public:
    void run();
    void setParams(int );
    bool isRunning();
private:
    void parseVCard(QByteArray &data, vCardHash &storeTable);
    vCardHash *contactsTable;
    bool running;
    QMobex *phone;
    int counter;
    int totalContacts;
    int currentContacts;
    QByteArray from;


};

#endif // LOADINGTHREAD_H
